home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Events
/
Tick.h
< prev
next >
Wrap
Text File
|
1997-06-28
|
1KB
|
45 lines
// Tick.h
#ifndef Tick_h
#define Tick_h
#ifndef Integers_h
#include "Integers.h"
#endif
class Tick
{
private:
int32 time;
public:
Tick( uint32 t ) : time( t ) {}
int32 Time() const { return time; }
static Tick Now() { return TickCount(); }
void operator+=( int32 d ) { time += d; }
void operator-=( int32 d ) { time -= d; }
Tick operator+( int32 d ) const { return time + d; }
Tick operator-( int32 d ) const { return time - d; }
int32 operator-( Tick t ) const { return time - t.time; }
bool operator==( Tick t ) const { return time == t.time; }
bool operator!=( Tick t ) const { return time != t.time; }
// We avoid the ordinary comparisons here so that we
// can compare times (locally) around the time when
// TickCount overflows.
bool operator<=( Tick t ) const { return time - t.time <= 0; }
bool operator>=( Tick t ) const { return time - t.time >= 0; }
bool operator<( Tick t ) const { return time - t.time < 0; }
bool operator>( Tick t ) const { return time - t.time > 0; }
void WaitFor() const;
};
#endif